libxc/restore: Don't duplicate state in process_vcpu_basic()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 18 Dec 2019 19:43:18 +0000 (19:43 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 24 Dec 2019 14:59:04 +0000 (14:59 +0000)
commite9bd648015dd192121307669555b396c5f68f2f2
tree50d7e0ec910da9b8a10fab1d2e1eed936a5a3b63
parentbb3b34be871899fa6055c884f503c77e61bdbc81
libxc/restore: Don't duplicate state in process_vcpu_basic()

vcpu_guest_context_any_t is currently allocated on the stack, and copied from
a mutable buffer which is freed immediately after its use here.  Mutate the
buffer in place instead of duplicating it.

The code is as it is due to how it was developed.  Originally,
process_vcpu_basic() operated on a const pointer from the X86_VCPU_BASIC
record, but during upstreaming, the addition of Remus support required
buffering of X86_VCPU_BASIC records each checkpoint.

By the time process_vcpu_basic() runs, we are commited to completing state
restoration and unpausing the guest.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/xc_sr_restore_x86_pv.c